/*
 * Action.cpp
 *
 *  Created on: 19.07.2009
 *      Author: h3llfire
 */

#include "Action.h"

namespace Impp{

IMPLEMENT_ABSTRACT_CLASS(Action, wxObject)


Action::Action(Buddy* buddy, time_t timeToLife) :
	id(0),
	buddy(buddy),
	expireTime(wxDateTime::GetTimeNow() + timeToLife),
	locks(0),
	deleted(false){
}

Action::~Action(){
}

bool Action::isTimedOut(){
	return wxDateTime::GetTimeNow() >= expireTime;
}

Buddy* Action::getBuddy(){
	return buddy;
}

void Action::setId(const ActionId & id){
	this->id=id;
}

ActionId Action::getId(){
	return id;
}

void Action::deleteAction(){
	deleted = true;
}

bool Action::isDeleted(){
	return deleted;
}

void Action::lock(){
	locks++;
}
void Action::unLock(){
	if(locks != 0){
		locks--;
	}
}

bool Action::isLocked(){
	return locks != 0;
}

}


